package com.gljx.web.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gljx.web.Entity.OtherRefundItem;
import com.gljx.web.dao.OtherRefundItemMapper;
import com.gljx.web.service.OtherRefundItemService;

@Transactional
@Service
public class OtherRefundItemServiceImpl implements OtherRefundItemService{

	@Autowired
	private OtherRefundItemMapper otherRefundItemMapper;
	
	@Override
	public List<OtherRefundItem> queryOtherRefundItemByCompanyId(String companyId) {
		// TODO Auto-generated method stub
		return otherRefundItemMapper.selectOtherRefundItemByCompanyId(companyId);
	}

	@Override
	public List<OtherRefundItem> queryOtherRefundItemByCompanyIdAndName(String companyId, String fnameL2) {
		// TODO Auto-generated method stub
		Map<String, String> map = new HashMap<>();
		map.put("companyId", companyId);
		map.put("fnameL2", fnameL2);
		return otherRefundItemMapper.selectOtherRefundItemByCompanyIdAndName(map);
	}

	@Override
	public void add(OtherRefundItem otherRefundItem) {
		// TODO Auto-generated method stub
		otherRefundItemMapper.insertSelective(otherRefundItem);
	}

	@Override
	public void modify(OtherRefundItem otherRefundItem) {
		// TODO Auto-generated method stub
		otherRefundItemMapper.updateByPrimaryKeySelective(otherRefundItem);
	}

	@Override
	public OtherRefundItem queryByPrimaryKey(String fid) {
		// TODO Auto-generated method stub
		return otherRefundItemMapper.selectByPrimaryKey(fid);
	}

	@Override
	public void deleteByFid(String[] deleteId, String fid) {
		// TODO Auto-generated method stub
		if (fid == null || "".equals(fid)) {
			for (int i = 0; i < deleteId.length; i++) {
				otherRefundItemMapper.deleteByPrimaryKey(deleteId[i]);
			}
		}else{
			otherRefundItemMapper.deleteByPrimaryKey(fid);
		}
	}

	@Override
    public List<OtherRefundItem> queryOtherRefundItemAll(String companyId) {
        // TODO Auto-generated method stub
        return otherRefundItemMapper.selectOtherRefundItemAll(companyId);
    }

	@Override
    public List<OtherRefundItem> queryOtherRefundItemByFnameL2(String fnameL2, String companyId) {
        // TODO Auto-generated method stub
        Map<String, String> map = new HashMap<>();
        map.put("fnameL2", fnameL2);
        map.put("companyId", companyId);
        return otherRefundItemMapper.selectOtherRefundItemByFnameL2(map);
    }

}
